//
//  NoteBL.m
//  MyNotes
//
//  Created by chen on 17/3/15.
//  Copyright © 2017年 chen. All rights reserved.
//

#import "NoteBL.h"

@implementation NoteBL
-(NSMutableArray *)createNote:(Note *)model{
//    NoteDao *dao = [NoteDao sharedInstance];
//    [dao create:model];
//    return [dao findAll];
    FMDBDao *dao = [FMDBDao shareDatabase];
    [dao insertNoteData:model];
    return [dao readNoteDataByTid:1];
}
-(NSMutableArray *)remove:(Note *)model{
//    NoteDao *dao = [NoteDao sharedInstance];
//    [dao remove:model];
//    return [dao findAll];
    FMDBDao *dao = [FMDBDao shareDatabase];
    [dao deleteNoteDataByCid:model.cid];
    return [dao readNoteDataByTid:1];
}
-(NSMutableArray *)findAll:(NSInteger)tid{
//    NoteDao *dao = [NoteDao sharedInstance];
//    return [dao findAll];
    FMDBDao *dao = [FMDBDao shareDatabase];
    return [dao readNoteDataByTid:tid];
}


@end
